package com.redhat.redwork.widget;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class TopicBridgeTag extends ComponentTagSupport {

	private static final long serialVersionUID = 1882083741249934379L;
	
	protected String publisher;
	protected String publisherTopic;
	protected String subscriber;
	protected String subscriberTopic;

	@Override
	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new TopicBridge(stack, req, res);
	}
	
	@Override
	protected void populateParams() {
		super.populateParams();
		((TopicBridge) component).setPublisher(publisher);
		((TopicBridge) component).setPublisherTopic(publisherTopic);
		((TopicBridge) component).setSubscriber(subscriber);
		((TopicBridge) component).setSubscriberTopic(subscriberTopic);
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public String getPublisherTopic() {
		return publisherTopic;
	}

	public void setPublisherTopic(String publisherTopic) {
		this.publisherTopic = publisherTopic;
	}

	public String getSubscriber() {
		return subscriber;
	}

	public void setSubscriber(String subscriber) {
		this.subscriber = subscriber;
	}

	public String getSubscriberTopic() {
		return subscriberTopic;
	}

	public void setSubscriberTopic(String subscriberTopic) {
		this.subscriberTopic = subscriberTopic;
	}
}
